<script>
	var url;
	$(document).ready(function(){
		
		$(function(){
			$('#dg').datagrid({url:"<?=base_url()?>lap_peserta/grid"});
		});
		
		// filter
		filter = function(){
			$('#dg').datagrid('load',{
				PMBPeriodID : $('#s_PMBPeriodID').val(),
			});
			//$('#dg').datagrid('enableFilter');
		}
		
		//# Tombol Bawah
		$(function(){
			var pager = $('#dg').datagrid().datagrid('getPager');	// get the pager of datagrid
			pager.pagination({
				buttons:[					
					{
						iconCls:'icon-print',
						text:'Export PDF',
						handler:function(){
						var PMBPeriodID = $('#s_PMBPeriodID').val();
						if(PMBPeriodID !=''){
							window.open('<?=base_url().'lap_peserta/laporan_pdf'?>/'+$('#s_PMBPeriodID').val());
						}
						else{
								$.messager.show({
									title: 'Warning',
									msg: 'Harap Isi Filter Terlabih Dahulu'
								});
							}
						}
					},
					{
						iconCls:'icon-excel',
						text:'Export EXCEL',
						handler:function(){
							window.open('<?=base_url().'lap_peserta/laporan_excel'?>');
						}
					}
				]
			});			
		});
		
	});
</script>
<table id="dg" title="Laporan Peserta Pendaftaran Mahasiswa Baru" data-options="
			rownumbers:true,
			singleSelect:true,
			autoRowHeight:false,
			pagination:true,
			pageSize:30,
			fit:true,
			toolbar:'#toolbar',
			">
	<thead>
		<tr>
			<!--<th field="tahun_penerimaan" sortable="true" width="80">Tahun Penerimaan</th>-->
			<th field="id_pendaftaran" hidden="true" sortable="true" width="100">id_pendaftaran</th>
			<th field="no_pendaftaran" sortable="true" width="100">No Pendaftaran</th>
			<th field="nama" sortable="true" width="125">Nama</th>
			<th field="alamat" sortable="true" width="150">Alamat</th>
			<th field="asal_sekolah" sortable="true" width="125">Asal Sekolah</th>
			<th field="no_telp" sortable="true" width="100">No Telepon</th>
			<th field="email" sortable="true" width="150">Email</th>
			<th field="prodi1" sortable="true" width="125">Pilihan 1</th>
			<th field="prodi2" sortable="true" width="125">Pilihan 2</th>
		</tr>
	</thead>
</table>
<div id="toolbar" style="padding:5px;height:auto">
	<div>
		<table width="700" border="0">
		  <tr>
			<td>Periode / Gelombang</td>
			<td>: 
				<select id="s_PMBPeriodID" name="s_PMBPeriodID" style="width:290px;">
					<?=$this->mdl_prosedur->OptionJadwalPMB();?>
				</select>
			</td>
			<td>&nbsp;</td>
			<td>&nbsp;&nbsp;<a href="#" onclick="filter()" class="easyui-linkbutton" iconCls="icon-search">Filter</a></td>
		  </tr>
		</table>
	</div>
</div>
